<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>

    function A(){
        this.a = 10
        this.title = "这是A类的属性"
    }
    function B(){
        this.b = 20
        this.title = "这是B类的属性"
    }
    function C(){
        this.c = 30
        this.title = "这是C类的属性"
    }

    function Parent(m){
        this.msg = m;
        this.show = function(){
            console.log(this.msg)
        }
    }
    Parent.prototype.init = function(){
        console.log("init")
    }

    function Child(m){
        // 改变：this 指向 Parent的this
        // （让Parent的this指向当前this）
        Parent.call(this, m)
        // Parent.apply(this, [m])
        // Parent.bind(this, m)();
        C.call(this);
        A.call(this);
        B.call(this);
    }

    
    const p = new Parent("hello");
    console.log(p)
    p.show();
    p.init();
    
    const c = new Child("world");
    console.log(c)
    c.show();
    c.init();
    

    
</script>
</html>